﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace SVAccountingWebUI.Login
{
    public partial class Login : BaseClasses.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void LoginControl_Authenticate(object sender, AuthenticateEventArgs e)
        {
            try
            {
                if (Membership.ValidateUser(LoginControl.UserName, LoginControl.Password))
                {
                    e.Authenticated = true;
                    Session["UserName"] = LoginControl.UserName;
                    string promenlina = Roles.GetRolesForUser(LoginControl.UserName).Single();
                    Session["Role"] = promenlina;
                }
                else
                    e.Authenticated = false;
            }
            catch (Exception exx)
            {
                //Log.Log.WriteLog(exx.Message + " - " + exx.Source + " - " + exx.StackTrace, Server.MapPath("~/Error"));
            }

        }


    }
}
